package config

import (
	"fmt"
	"github.com/spf13/viper"
)

type Appconfig struct {
	Mysql Mysql
}
type Mysql struct {
	Host string
	Port int
	User string
	Pass string
	Data string
}

var Config Appconfig

func Init() {
	var err error
	viper.SetConfigFile("config/dev.yaml")
	err = viper.ReadInConfig()
	if err != nil {
		panic(err)
	}
	err = viper.Unmarshal(&Config)
	if err != nil {
		panic(err)
	}
	fmt.Println("配置文件读取成功", Config)
}
